﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Micua.Utility;

namespace Micua.UnitTest
{
    [TestClass]
    public class EvalTester
    {
        [TestMethod]
        public void MyTestMethod()
        {

            EvaluatorItem[] items = {                                 new EvaluatorItem(typeof(int)/*方法返回值类型*/,"return int.Parse(obj.ToString())+11;"/*要执行的字符串代码*/, "GetNumber"/*方法名称*/)                        };
            Evaluator eval = new Evaluator(items);
            int a = 90;
            object obj = a;/*方法需要的参数,在方法里面的 形参为(obj) */
            var res = eval.EvaluateInt("GetNumber" /*要调用的方法名*/, obj /*实参*/).ToString();

            Console.WriteLine(res);

            Assert.AreEqual(res, a + 11);
        }
    }
}